package com.ytxg.health_management.pojo.entity;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.Serializable;

@Data
@AllArgsConstructor
public class Result<T> implements Serializable {
    private int code;
    private String msg;
    private T data;

    public static <T> Result<T> success(T data) {
        return new Result<T>(200,"成功",data);
    }
    public static <T> Result<T> success(String msg, T data) {
        return new Result<T>(200,msg,data);
    }
    public static <T> Result<T> fail(String msg) {
        return new Result<T>(500,msg,null);
    }
    public static <T> Result<T> fail(int code,String msg) {
        return new Result<T>(code,msg,null);
    }

}
